/**
 * 关卡
 */

import Data from './Data'
import King from './King';
 export default class Level extends Laya.Script {

    constructor() { super() }
    
    // 数据
    private _data: any

    // 跳王预制体
    /** @prop {name:king,tips:"跳王预制体",type:Prefab}*/
    private king: Laya.Prefab;

    onEnable(): void {
        this._data = Data
        this.addKing()
    }


    // 初始化跳王
    private addKing(): void {
        let king: Laya.Sprite = Laya.Pool.getItemByCreateFun("base_bullet", this.king.create, this.king);
        king.pos(this._data._x, this._data._y);
        let c = king.getComponent(King)
        this.owner.parent.addChild(king);
        c.setSpeed(this._data._vx, this._data._vy)
    }

 }